================================================================================
AIOS CORE v1.0.1 Changelog
Advanced Interface Optimization System
Author: Poorkingz
Date: 2026-05-11
================================================================================

FIXED
--------------------------------------------------------------------------------
- SavedVariables persistence
  Core/Saved/Init.lua rewritten to prevent double-initialization that wiped
  saved data on every /reload. Now detects existing AIOS_Saved data and
  preserves it instead of creating empty tables.

- SavedVariables comma formatting in TOC
  Removed space after comma: ## SavedVariables: AIOS_Saved,AIOS_Config
  (Was: AIOS_Saved, AIOS_Config — spaces break WoW parsing)

- Core/Saved load order
  Moved Core/Saved files before Lean, Timers, Locale in TOC so services
  that use Core::Saved can find it at load time.

- Core/Saved/Store.lua nil crash
  Added EnsureInit() guard for early-load calls from other addons.
  HaloBar and similar addons calling CreateReactiveStore during file load
  no longer crash with "attempt to index field '_saved' (a nil value)".

- Core/Saved/Operations.lua nil crash
  Added EnsureInit() guard on all functions. Added SetBatch, Delete,
  DeleteNamespace for full CRUD support.

- Core/Saved/Schema.lua data loss
  Fixed _ApplyDefaultsFor to deep-copy defaults only into missing keys.
  Previously overwrote all existing data with defaults on every init.

- Core/Saved/Profile.lua missing dependency
  Added built-in DeepCopy function. Removed broken dependency on
  AIOS.Utils:DeepCopy which does not exist.

ADDED
--------------------------------------------------------------------------------
- Saved:SetBatch(namespace, data)
  Save multiple key/value pairs in one call.

- Saved:Delete(namespace, key)
  Remove a single key from a namespace.

- Saved:DeleteNamespace(namespace)
  Completely wipe a namespace and all its data.

- Saved:ListProfiles()
  Returns sorted table of all saved profile names.

- Saved:CountNamespaces()
  Returns number of saved namespaces for diagnostics.

- Init.lua diagnostic logging
  Prints initialization state to chat for troubleshooting save issues.
  Shows whether AIOS_Saved was found or created fresh.

CHANGED
--------------------------------------------------------------------------------
- Core/Saved/Init.lua v1.2.4
  Now uses two-phase init: waits for PLAYER_LOGIN if AIOS_Saved is nil
  (first login), or inits immediately if saved data already exists (/reload).

- All Saved submodules
  Auto-init on first function call instead of throwing nil errors when
  called before PLAYER_LOGIN.

================================================================================
FILES MODIFIED
================================================================================
AIOS.toc
Core/Saved/Init.lua
Core/Saved/Store.lua
Core/Saved/Operations.lua
Core/Saved/Schema.lua
Core/Saved/Profile.lua

================================================================================
TEST RESULTS
================================================================================
- Set/Get single value: PASS
- Batch save: PASS
- Data persists after /reload: PASS
- Data persists after logout/login: PASS
- Profile switch and persist: PASS
- Cross-addon early access (HaloBar): PASS
================================================================================